package com.yhsimon.mediator.smarthouse;

/**
 * @author： YHSimon
 * @date： 2021-10-19 10:34
 */
public class ClientTest {
    public static void main(String[] args) {
        //创建一个中介者对象
        Mediator mediator = new ConcreteMediator();

        Alarm alarm = new Alarm(mediator, "Alarm");

        //创建 Alarm并且加入到ConcreteMediator
        CoffeeMachine coffeeMachine = new CoffeeMachine(mediator, "CoffeeMachine");
        //创建Curtains , 并且加入到ConcreteMediator 对象的
        Curtains curtains = new Curtains(mediator, "curtains");
        TV tV = new TV(mediator, "TV");
        //让闹钟发出消息
        alarm.sendAlarm(0);
        coffeeMachine.finishCoffee();
        alarm.sendAlarm(1);
    }
}
